package com.javabasic.algorithm.leetcode;

/**
 * @author mir.xiong
 * @version 1.0
 * @description
 * @see [1037. Valid Boomerang](https://leetcode-cn.com/problems/valid-boomerang/)
 * @since Created by work on 2022/1/7 11:55 下午
 */
public class ValidBoomerang {

    /**
     * 正弦函数，判断是否3点共线
     * @param points
     * @return
     */
    public boolean isBoomerang(int[][] points) {
        int x1 = Math.abs(points[0][0] - points[1][0]);
        int x2 = Math.abs(points[0][0] - points[2][0]);
        int x3 = Math.abs(points[1][0] - points[2][0]);
        int y1 = Math.abs(points[0][1] - points[1][1]);
        int y2 = Math.abs(points[0][1] - points[2][1]);
        int y3 = Math.abs(points[1][1] - points[2][1]);
        return y1*x2 != x1*y2 || y1*x3 != x1*y3;
    }
}
